package com.evil.account.api;

import com.evil.account.config.FeignErrorDecoder;
import com.evil.common.account.bo.AuthUserBO;
import com.evil.common.account.dto.LoginReqDTO;
import com.evil.common.account.dto.LogoutReqDTO;
import com.evil.common.account.dto.user.UserBaseRespDTO;
import com.evil.common.account.dto.user.UserEnterpriseDTO;
import com.evil.common.core.constant.ServiceNameConstant;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 登录接口
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@FeignClient(name = ServiceNameConstant.ACCOUNT_SERVICE, configuration = {FeignErrorDecoder.class})
public interface RemoteLoginService {

    /**
     * 登录
     *
     * @param loginReqDTO 参数
     */
    @PostMapping("/login")
    AuthUserBO login(@Validated @RequestBody LoginReqDTO loginReqDTO);

    /**
     * 登出
     */
    @PostMapping("/logout")
    void logout(@Validated @RequestBody LogoutReqDTO logoutReqDTO);

    /**
     * 获取当前登录用户id
     *
     * @return id
     */
    @PostMapping("get/login/user/id")
    Long getLoginUserId();

    /**
     * 获取当前登录用户
     *
     * @return user
     */
    @PostMapping("get/login/user")
    UserBaseRespDTO getLoginUser();

    /**
     * 获取当前企业id
     *
     * @return user
     */
    @PostMapping("get/enterprise/id")
    Long getLoginEnterpriseId();

    /**
     * 获取当前企业
     *
     * @return user
     */
    @PostMapping("get/enterprise")
    UserEnterpriseDTO getLoginEnterprise();

}
